/***************
 * Home Inquiries Panel
 */
AIR2.Home.Inquiries = function() {
    return new AIR2.UI.Panel({
        colspan: 2,
        title: 'Queries',
        cls: 'air2-home-inquiry',
        iconCls: 'air2-icon-inquiry',
        showTotal: true,
        showAllLink: AIR2.HOMEURL+'/search/inquiries',
        storeData: AIR2.Home.INQDATA,
        itemSelector: '.air2-home-inquiry-row',
        tpl: new Ext.XTemplate(
            '<table>' +
             '<tr>' +
              '<th>INQUIRY</th>' +
              '<th class="right">ORGANIZATION</th>' +
              '<th class="right">SUBMISSIONS</th>' +
              '<th class="right">SENT</th>' +
             '</tr>' +
            '<tpl for="."><tr class="air2-home-inquiry-row">' +
              '<td>{[AIR2.Format.inquiryTitle(values, "name")]}</td>' +
              '<td align="right">{[this.inqOrigin(values.CreUser)]}</td>' +
              '<td align="right">{ReceivedCount}</td>' +
              '<td align="right">{[AIR2.Format.date(values.inq_cre_dtim)]}</td>' +
            '</tr></tpl>' +
            '</table>',
            {
                compiled: true,
                disableFormats: true,
                inqOrigin: function(user) {
                    if (user.UserOrg.length > 0) {
                        return AIR2.Format.userOrgShort(user.UserOrg[0], true);
                    }
                    else {
                        return '(' + AIR2.Format.userName(user) + ')';
                    }
                }
            }
        )
    });
}
